package com.education.welco.service.impl;


import com.education.common.utils.Convert;
import com.education.welco.mapper.SCatalogMapper;
import com.education.welco.pojo.SCatalog;
import com.education.welco.pojo.vo.ScatalogClassVO;
import com.education.welco.pojo.vo.ScatalogVO;
import com.education.welco.service.ISCatalogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 教师创建课程 服务层实现
 *
 * @author d
 * @date 2020-05-08
 */
@Service
public class SCatalogServiceImpl implements ISCatalogService {
    @Autowired
    private SCatalogMapper sCatalogMapper;

//    @Override
//    public List<SCatalog> findByUserIdAndClassId(Integer userId, Integer classId,Integer catalogState) {
//        return sCatalogMapper.findByUserIdAndClassId(userId,classId,catalogState);
//    }


    @Override
    public List<ScatalogClassVO> findClassScheduleByTeaId(Integer teaId, String toDayString, String keyWord) {
        return sCatalogMapper.findClassScheduleByTeaId(teaId, toDayString,keyWord);
    }

    /**
     * 直播课的状态修改
     * @return
     */
    @Override
    public int updateLiveCourseStatus() {
        return sCatalogMapper.updateLiveCourseStatus();
    }

    @Override
    public SCatalog courseIntro(String courseId) {
        return sCatalogMapper.courseIntroByCourseId(courseId);
    }

    @Override
    public List<ScatalogClassVO> findClassScheduleByClassId(Integer classId, String toDayString,String keyWord) {
        return sCatalogMapper.findClassScheduleByClassId(classId, toDayString,keyWord);
    }

    @Override
    public List<ScatalogClassVO> findCourseByClassId(Integer classId, String keyWord) {
        return sCatalogMapper.findCourseByClassId(classId, keyWord);
    }

    @Override
    public List<SCatalog> findByMenuId(Integer menuId) {
        return sCatalogMapper.findByMenuId(menuId);
    }

    @Override
    public List<SCatalog> findByUserIdAndClassId2(ScatalogVO scatalogVO) {
        return sCatalogMapper.findByUserIdAndClassId2(scatalogVO);
    }

    @Override
    public List<SCatalog> findByUserIdAndClassId3(ScatalogVO scatalogVO) {
        return sCatalogMapper.findByUserIdAndClassId3(scatalogVO);
    }

    @Override
    public List<SCatalog> findByUserIdAndClassId(ScatalogVO scatalogVO) {
        return sCatalogMapper.findByUserIdAndClassId(scatalogVO);
    }

    /**
     * 查询教师创建课程信息
     *
     * @param id 教师创建课程ID
     * @return 教师创建课程信息
     */
    @Override
    public SCatalog selectSCatalogById(Integer id) {
        return sCatalogMapper.selectSCatalogById(id);
    }

    /**
     * 查询教师创建课程列表
     *
     * @param sCatalog 教师创建课程信息
     * @return 教师创建课程集合
     */
    @Override
    public List<SCatalog> selectSCatalogList(SCatalog sCatalog) {
        return sCatalogMapper.selectSCatalogList(sCatalog);
    }

    /**
     * 新增教师创建课程
     *
     * @param sCatalog 教师创建课程信息
     * @return 结果
     */
    @Override
    public int insertSCatalog(SCatalog sCatalog) {
        return sCatalogMapper.insertSCatalog(sCatalog);
    }

    /**
     * 修改教师创建课程
     *
     * @param sCatalog 教师创建课程信息
     * @return 结果
     */
    @Override
    public int updateSCatalog(SCatalog sCatalog) {
        return sCatalogMapper.updateSCatalog(sCatalog);
    }

    /**
     * 删除教师创建课程对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteSCatalogByIds(String ids) {
        return sCatalogMapper.deleteSCatalogByIds(Convert.toStrArray(ids));
    }
}